package com.von.service.impl;

import com.von.mapper.RoleResourceMapper;
import com.von.entity.RoleResource;
import com.von.service.IRoleResourceService;
import com.von.utils.RedisUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author pengzhaofeng
 * @since 2020-05-28
 */
@Service
public class RoleResourceServiceImpl extends ServiceImpl<RoleResourceMapper, RoleResource> implements IRoleResourceService {

    @Autowired
    private RedisUtils redisUtils;

    @Autowired
    private RoleResourceMapper roleResourceMapper;

    @Override
    public void init() {
        List<Map<String, String>> init = roleResourceMapper.init();
        init.forEach(a -> redisUtils.put("authority", a.get("url"), a.get("roleId")));
    }
}
